import 'package:flutter/material.dart';
import 'package:aweb5/base/BaseWidget.dart';

class UseCoupon extends BaseWidget {
  @override
  State<UseCoupon> createState() => UseCouponState();
}

class UseCouponState extends BaseWidgetState<UseCoupon> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: appBarWithBack("使用优惠券"),
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.end,
        children: <Widget>[
          Divider(
            height: 1,
            color: Color(0xfffafafa),
          ),
          Container(
            height: 24,
            margin: EdgeInsets.only(top: 10, bottom: 10, right: 10),
            padding: EdgeInsets.only(left: 10, right: 10),
            decoration: BoxDecoration(
                color: Color(0xffff8900),
                borderRadius: BorderRadius.circular(10)),
            child: Text(
              "不使用优惠券",
              style: TextStyle(color: Colors.white, fontSize: 12),
            ),
          ),
          Divider(
            height: 1,
            color: Color(0xffe9e9e9),
          ),
          Expanded(
              child: ListView.builder(
            shrinkWrap: true,
            itemCount: 5,
            itemBuilder: (con, ind) {
              return item();
            },
          ))
        ],
//        Divider(height: 1,color: Color(0xfffafafa),),
      ),
    );
  }

  Widget item() {
    return Column(
      children: <Widget>[
        Container(
          color: Colors.white,
          height: 10,
        ),
        Container(
          height: 120,
          decoration: BoxDecoration(
              image: DecorationImage(
                  image: AssetImage("assets/couponnotused.png"),
                  fit: BoxFit.fill)),
          margin: EdgeInsets.only(left: 10, right: 10),
          child: Row(
            children: <Widget>[
              Expanded(
                child: Text(""),
                flex: 34,
              ),
              Expanded(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Text(
                      "满100减50",
                      style: TextStyle(color: Colors.white, fontSize: 18),
                    ),
                    Text(
                      "满减",
                      style: TextStyle(color: Colors.white, fontSize: 14),
                    ),
                    Text(
                      "订单满2000元",
                      style: TextStyle(color: Colors.white, fontSize: 10),
                    ),
                    Text(
                      "2017.12.23 15:20:10-2018.2.15 17:30:10",
                      style: TextStyle(color: Colors.white, fontSize: 9),
                    ),
                  ],
                ),
                flex: 186,
              ),
              Expanded(
                child: Text(""),
                flex: 10,
              ),
              Expanded(
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: <Widget>[
                      Text(
                        "¥50",
                        style: TextStyle(color: Colors.white, fontSize: 36),
                      ),
                      SizedBox(
                        height: 12,
                      ),
                      Container(
                        decoration: BoxDecoration(
                            color: Colors.white,
                            borderRadius: BorderRadius.circular(12)),
                        padding: EdgeInsets.only(
                            left: 10, right: 10, top: 3, bottom: 3),
                        child: Text(
                          "已领取",
                          style:
                              TextStyle(color: Color(0xffff6200), fontSize: 14),
                        ),
                      )
                    ],
                  ),
                  flex: 115)
            ],
          ),
        ),
        Container(
          color: Colors.white,
          height: 10,
        )
      ],
    );
  }
}
